package com.orivon.mob.hook;

import android.app.Application;

import org.xutils.DbManager;
import org.xutils.x;

import cn.bmob.push.BmobPush;
import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobInstallation;

/**
 * Created by Eenie on 2016/2/24.
 * Email:472279981@qq.com
 */
public class HookApplication extends Application {

    private static HookApplication instance;
    DbManager dbManager;
    DeviceInfo info;
    boolean isChecked = false;


    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;

        x.Ext.init(this);
//        initXdb();
        // 初始化BmobSDK
        Bmob.initialize(this, "8610f715d1832efc7f823108ea30870d");
        // 使用推送服务时的初始化操作
        BmobInstallation.getCurrentInstallation(this).save();
        // 启动推送服务
        BmobPush.startWork(this);

        info = new DeviceInfo();
        info.setImei(Utiles.getImei(this));
        info.setMac(Utiles.getWifiMac(this));
        info.save(this);


    }

    public static HookApplication getInstance() {
        return instance;
    }


    public DeviceInfo getDeviceInfo() {
        return info;
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }


//    private void initXdb() {
//        DbManager.DaoConfig config = new DbManager.DaoConfig();
//        config.setDbName("data.db")
//                .setAllowTransaction(true)
//                .setDbVersion(2);
//        dbManager = x.getDb(config);
//    }
//
//    public DbManager getDbManager() {
//        return dbManager;
//    }
}
